package com.adtec.base.cloud.baseservice.sms.config.handler;

import com.adtec.base.cloud.commons.exception.AjaxResponse;
import com.adtec.base.cloud.commons.exception.CustomExceptionType;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestParam;

@Slf4j
public class SmsControllerHandler {
    public static AjaxResponse sendBlockHandler(@RequestParam Integer userId,
                                                    BlockException blockException) {
        log.info("请稍后再试");
        return AjaxResponse.error(CustomExceptionType.SYSTEM_ERROR,
                "尊敬的客户您好，系统服务繁忙，请稍后再试!");
    }

    public static AjaxResponse sendFallback(@RequestParam String phoneNo,
                                            @RequestParam String content,
                                            Throwable e) {
        log.info("短信服务发送接口出现错误");

        return AjaxResponse.error(CustomExceptionType.SYSTEM_ERROR,
                "短信服务发送接口出现错误"+e.getMessage());
    }
}